<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <include file="Public:meta"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
<include file="Public:header"/>
<!-- BEGIN CONTAINER -->
<div class="page-container">
    <include file="Public:sidebar"/>
    <!-- BEGIN PAGE -->
    <div class="page-content">
        <!-- BEGIN PAGE CONTAINER-->
        <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->
            <div class="row-fluid">
                <!-- begin BCN -->
                <div class="row-fluid">
                    <div class="span12"><ul class="breadcrumb"><li>{$PageName|default="未命名"}</li></ul></div>
                </div>
                <!-- end BCN -->
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->
            <div class="row-fluid white">
                <div class="span12">
                    <!-- begin 操作与分页 -->
                    <div class="row-fluid ">
                        <div class="dataTables_length pull-left">
                            <form id="limit_form" name="limit_form" method="post" action="">
                                <label for="limit_num">
                                    <select class="limit_num" id="limit_num" name="limit_num">
                                    <volist name="page_limit_num" id="vo">
                                        <option <eq name="_SESSION['page_limit_num']" value="$vo"> selected="selected" </eq> value="{$vo}">{$vo}</option>
                                    </volist>
                                    </select>
                                    个记录/每个页面
                                </label>
                            </form>
                        </div>
                    </div>
                    <!-- end 操作与分页 -->
                    <div class="portlet-body">
                        <table class="table table-striped table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>用户</th>
                                <th>商品</th>
                                <th>图片</th>
                                <th>评论</th>
                                <th>评分</th>
                                <th>发布时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <notempty name="list">
                                <tbody>
                                <volist name="list" id="vo">
                                    <tr>
                                        <td>{$vo.user_id|getTitle=###,Member,nickname}</td>
                                        <td>{$vo.goods_id|getTitle=###,Goods}</td>
                                        <td>
                                            <notempty name="vo.attach">
                                                <volist name="vo['attach']" id="v">
                                                    <img src="{$v}" style="display:inline-block;width:50px;height:50px;margin-right:10px;" />
                                                </volist>
                                            </notempty>
                                        </td>
                                        <td>
                                            <div title="{$vo.content}">
                                                {$vo.content|msubstr=###,0,15}
                                                <neq name="vo.reply" value="">
                                                    <div title="{$vo.reply}">回复：{$vo.reply|msubstr=###,0,15}</div>
                                                </neq>
                                            <div>
                                        </td>
                                        <td>
                                            <div>
                                                商品：{$vo.product_level}
                                            <div>
                                            <div>
                                                服务：{$vo.service_level}
                                            <div>
                                            <div>
                                                物流：{$vo.postage_level}
                                            <div>
                                        </td>
                                        <td>{$vo.crdate|date="Y-m-d H:i:s",###}</td>
                                        <td>
                                            <if condition="checkAccess('Comment', 'reply')">
                                                <empty name="vo.reply">
                                                    <a class="btn green-stripe mini" href="javascript:void(0);" data-id="{$vo.id}">回复</a>
                                                </empty>
                                            </if>
                                        </td>
                                    </tr>
                                </volist>
                                </tbody>
                            </notempty>
                        </table>
                    </div>
                    <div class="pages clearfix">
                        <include file="Public:page" />
                    </div>
                </div>
            </div>
            <!-- END PAGE CONTENT-->
        </div>
        <!-- END PAGE CONTAINER-->
    </div>
    <!-- END PAGE -->
</div>
<!-- END CONTAINER -->
<div class="tips" style="display:none">
    <div class="content">
        <form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
            <div class="list">
                评论回复
            </div>
            <div class="list">
                <textarea rows="3" name="content" placeholder="请输入回复内容"></textarea>
            </div>
            <input type="hidden" name="id" value="" />
            <div class="list">
                <button type="button" class="btn blue">回复 <i class="icon-save"></i></button>
            </div>
        </form>
    </div>
</div>
<style type="text/css">
    .tips{
        position: absolute;
        top:0;
        left:0;
        width:100%;
        height: 100%;
        z-index:9999;
        color: #000;
    }
    .content{
        position: fixed;
        top:30%;
        left:30%;
        width:500px;
        height:230px;
        background: #f4f4f4;
        box-shadow:5px 2px 6px #000;
    }
    .content form{
        display: block;
        padding: 0;
        margin:0;
        width:100%;
        height:100%;
        border-radius: 5px;
    }
    .list{
        text-align: center;
        padding:15px 30px;
    }
    textarea{
        display: block;
        width:100%;
    }
</style>
<include file="Public:footer"/>
<script type="text/javascript">
    jQuery(document).ready(function () {
        $('a.btn').on('click',function(){
            $('input[name=id]').val($(this).data('id'));
            $('.tips').show();
        });
        $('.content button').on('click',function(){
            var value = $('.content form textarea').val();
            if(!/\S/.test(value)){
                custom_alert('请输入回复内容');
                return
            }
            $('.content form').ajaxSubmit({
                url: "{:U(CONTROLLER_NAME.'/reply')}",
                dataType: 'json',
                error: function (){
                    $('.tips').hide();
                    $('body').modalmanager('loading');
                    custom_alert('提交失败，请稍后再试！', window.location);
                },
                success: function (rs) {
                    $('.tips').hide();
                    $('body').modalmanager('loading');
                    if (rs.url != '') {
                        custom_alert(rs.info, rs.url);
                    } else {
                        custom_alert(rs.info);
                    }
                },
                beforeSend: function (){
                    $('.tips').hide();
                    $('body').modalmanager('loading');
                }
            });
        });
    });
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>